package service

import (
	"context"
	"gitee.com/shuokeyun/med-bff/internal/domain"

	pb "gitee.com/shuokeyun/med-bff/api/v1"
)

// OrderService .
type OrderService struct {
	pb.UnimplementedOrderServer
	order domain.OrderUsecase
}

// NewOrderServer .
func NewOrderServer(order domain.OrderUsecase) pb.OrderServer {
	return &OrderService{
		order: order,
	}
}

// CreateOrder .
func (s *OrderService) CreateOrder(ctx context.Context, req *pb.CreateOrderRequest) (*pb.CreateOrderReply, error) {
	do := createOrderRequestConvDo(ctx, req)
	id, err := s.order.CreateOrder(ctx, do)
	if err != nil {
		return nil, err
	}
	return &pb.CreateOrderReply{
		Id: id,
	}, nil
}

// GetOrder .
func (s *OrderService) GetOrder(ctx context.Context, req *pb.GetOrderRequest) (*pb.GetOrderReply, error) {
	return &pb.GetOrderReply{}, nil
}

// ListOrder .
func (s *OrderService) ListOrder(ctx context.Context, req *pb.ListOrderRequest) (*pb.ListOrderReply, error) {
	return &pb.ListOrderReply{}, nil
}
